﻿package com.ufenlei.LTS{
	
	public class TestingRadioGroup extends RadioGroup{
		private var _gtype:String;
		public function TestingRadioGroup(gtype:String){
			super();
			_gtype = gtype;
		}
		public function showKey(idx:int):void{
			(_radioList[idx] as TestingRadio).showKey();
		}
		override public function addRadio(rLabel:String,rIdx:int):void{
			var op:TestingRadio;
			switch(_gtype){
				case TestingItem.TYPE_TEXT:
					op = new TestingTextRadio(rLabel,_radioList.length);
					op.y = _radioList.length* 35 + 5;
					break;
				case TestingItem.TYPE_IMAGE:
					op = new TestingImageRadio(rLabel,_radioList.length);
					op.y = Math.floor( _radioList.length/2 ) * (140 + 5);
					op.x = (_radioList.length % 2) * (180 + 50);
					break;
				default:
					trace("error , unsoloved TestingRadioGroup Type");
			}
			if(op){
				op.addEventListener(Input.SELECTED, onRadioSelected);
				_keyList.push(rIdx);
				_radioList.push(op);
				this.addChild(op);
			}
		}
		public function get answer():uint{
			return _keyList[_checkdIndex];
		}
	}
}